package com.easondongh.common.shiro;

import com.easondongh.system.common.ActiveUser;
import com.easondongh.system.domain.SysUser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

/**
 * @author EasonDongH
 * @date 2020/5/4 20:27
 */
public class ShiroUtils {

    public static SysUser getCurrentLoginUser() {
        Subject subject = SecurityUtils.getSubject();
        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
        if(null == activeUser){
            return null;
        }
        SysUser user = activeUser.getUser();
        return user;
    }
}
